package com.zhaojindong.ioc.component.register.conditional;

import lombok.extern.log4j.Log4j;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.env.Environment;

/**
 * created by dean on 2018/8/18
 */
@Log4j
public class MainTest {

    @Test
    public void testMethod() {
        ApplicationContext context = new AnnotationConfigApplicationContext(MainConfig.class);
        Environment environment = context.getEnvironment();
        String property = environment.getProperty("os.name");
        log.info("os name:" + property);

        String[] names = context.getBeanDefinitionNames();
        for (String name : names) {
            log.info("bean name:" + name);
        }
    }
}